﻿using Mapster;
using MapsterMapper;
using System;

namespace WebApi.ClassMapper
{
    public class CP
    {
        /// <summary>
        /// 
        /// </summary>
        private static readonly IMapper instance = null;
        /// <summary>
        /// 
        /// </summary>
        static CP()
        {
            if (instance== null)
            {
                var config = new TypeAdapterConfig();

                config.ForType<WXQ.InOutPutEntites.Input.PageInput, SqlSugar.PageModel>()
                    .Map(dest => dest.PageIndex, src => src.PageIndex)
                    .Map(dest => dest.PageSize, src => src.PageSize)
                    .Map(dest => dest.TotalCount, src => 0);

                instance = new Mapper(config);//务必将mapper设为单实例
            }



        }
        private CP()
        {
        }
        /// <summary>
        /// 
        /// </summary>
        public static IMapper Instance
        {
            get
            {
                return instance;
            }
        }
    }
}